package com.hejun.jwt_security.controller;

import com.hejun.jwt_security.mapper.UserMapper;
import com.hejun.jwt_security.utils.JwtUtils;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UserController {

    @Autowired
    UserMapper userMapper;

    @GetMapping("/isLike")
    public String isLike(HttpServletRequest request){
        String token = request.getHeader("token");
        try {
            JwtUtils.validate(token);
            return "校验通过，你是喜欢";
        } catch (Exception e) {
            return "token错误"+e.getMessage();
        }
    }

    @GetMapping("/admin")
    public String admin(){
        return "admin";
    }

    @GetMapping("/boss")
    public String boss(){
        return "boss";
    }
}
